package com.ctshk.app.system.controller;

import javax.validation.Valid;

import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.ctshk.common.annotations.OperationLogAnnotation;
import com.ctshk.common.dto.Result;
import com.ctshk.common.enums.OperationLogModel;
import com.ctshk.common.enums.OperationLogType;
import com.ctshk.common.model.PageResponse;
import com.ctshk.common.web.support.BaseController;
import com.ctshk.rpc.system.dto.LocalFunIncoDTO;
import com.ctshk.rpc.system.req.MainDataLocalFunAddReq;
import com.ctshk.rpc.system.service.IMainDataLocalFunService;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

/**
 * <p>
 *  城市-机场 主数据前端控制器
 * </p>
 *
 * @author lihang
 * @since 2021-03-18
 */
@Api(value = "主数据-当地玩乐")
@RestController
@RequestMapping("/main-data-local-fun")
public class MainDataLocalFunController extends BaseController {


    @DubboReference
    private IMainDataLocalFunService iMainDataLocalFunService;


    @ApiOperation(value = "当地玩乐类型列表", notes = "查询当地玩乐类型列表")
    @OperationLogAnnotation(operModul = OperationLogModel.LOCALFUN, operType = OperationLogType.QUERY, operTitle = "新增当地玩乐类型", operDesc = "新增当地玩乐类型")
    @PostMapping(value="/list")
    public Result<PageResponse<LocalFunIncoDTO>> list(@RequestBody @Valid MainDataLocalFunAddReq req){
        return iMainDataLocalFunService.list(req,getCurrentUser(getRequest()));
    }

    @ApiOperation(value = "当地玩乐类型列表", notes = "查询当地玩乐类型列表")
    @OperationLogAnnotation(operModul = OperationLogModel.LOCALFUN, operType = OperationLogType.QUERY, operTitle = "新增当地玩乐类型", operDesc = "新增当地玩乐类型")
    @PostMapping(value="/getTypeList")
    public Result<PageResponse<LocalFunIncoDTO>> getTypeList(@RequestBody @Valid MainDataLocalFunAddReq req){
        return iMainDataLocalFunService.getTypeList(req,getCurrentUser(getRequest()));
    }

    @ApiOperation(value = "新增当地玩乐类型", notes = "新增当地玩乐类型")
    @OperationLogAnnotation(operModul = OperationLogModel.LOCALFUN, operType = OperationLogType.ADD, operTitle = "新增当地玩乐类型", operDesc = "新增当地玩乐类型")
    @PostMapping(value="/add")
    public Result add(@RequestBody @Valid MainDataLocalFunAddReq req){
        return  iMainDataLocalFunService.add(req,getCurrentUser(getRequest()));
    }

    @ApiOperation(value = "修改当地玩乐类型", notes = "修改当地玩乐类型")
    @OperationLogAnnotation(operModul = OperationLogModel.LOCALFUN, operType = OperationLogType.UPDATE, operTitle = "编辑当地玩乐类型", operDesc = "编辑当地玩乐类型")
    @PostMapping(value="/edit")
    public Result edit(@RequestBody @Valid MainDataLocalFunAddReq req){
        return  iMainDataLocalFunService.edit(req,getCurrentUser(getRequest()));
    }

    @ApiOperation(value = "獲取当地玩乐类型主數據", notes = "修改当地玩乐类型")
    @OperationLogAnnotation(operModul = OperationLogModel.LOCALFUN, operType = OperationLogType.UPDATE, operTitle = "编辑当地玩乐类型", operDesc = "编辑当地玩乐类型")
    @PostMapping(value="/get-fun-type")
    public Result getFunType(){
        return iMainDataLocalFunService.getFunType();
    }


    @ApiOperation(value = "設置狀態", notes = "修改当地玩乐类型")
    @OperationLogAnnotation(operModul = OperationLogModel.LOCALFUN, operType = OperationLogType.UPDATE, operTitle = "编辑当地玩乐类型", operDesc = "编辑当地玩乐类型")
    @PostMapping(value="/updateStatus")
    public Result updateStatus(@RequestBody MainDataLocalFunAddReq mainDataLocalFunAddReq){
        return iMainDataLocalFunService.updateStatus(mainDataLocalFunAddReq);
    }

}
